import Koa from 'koa';

// Env settings
import env from '../../../../conf.js';

import proxyMiddleware from '../../common/middlewares/proxy.js';
import corsMiddleware from '../../common/middlewares/cors-middleware.js';

const proxyApp = new Koa();

proxyApp.use(corsMiddleware);
// Proxy requests for mock server
proxyApp.use(proxyMiddleware({
    host: `http://localhost:${env.API_MOCK_PORT}`,
    map: path => `/api${path}`
}));

export default proxyApp;